import numpy as np
import matplotlib.pyplot as plt
from python_ai.common.xcommon import sep

columns = ['Speed', 'Attack', 'Mobility', 'Stability', 'Range', 'Stealth']
data = [
    ['F-16', [5, 7, 6.5, 8, 7, 1]],
    ['F-22', [8, 8, 8, 7.5, 7, 9]],
    ['A-5', [5, 12, 1, 5, 5, 0.5]],
    ['C-130', [4, 0, 0, 4, 15, 0]]
]
n = len(columns)
m = len(data)

angles = np.linspace(0, 2 * np.pi, n + 1)

plt.figure(figsize=[8, 8])
spr = 1
spc = 1
spn = 0

spn += 1
plt.subplot(spr, spc, spn, projection='polar')
plt.xticks(angles[:-1], columns)
cmap = plt.cm.get_cmap('rainbow', m)
for i, (name, d_list) in enumerate(data):
    data = d_list.copy()
    data.append(data[0])
    plt.polar(angles, data, color=cmap(i), label=name)
plt.legend()

# Finally show all drawings.
plt.show()